﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GoogleMapsApiWebServices.Core;

namespace GoogleMapsApiWebServices.Directions
{
    public class DirectionsResponseParser
    {
        private string _responseText;

        public DirectionsResponseParser(string responseText)
        {
            _responseText = responseText;
        }

        public DirectionsResponse Parse()
        {
            DirectionsResponse response = new DirectionsResponse();

            MessageFormat messageFormat = _responseText.StartsWith("{") ? MessageFormat.Json : MessageFormat.Xml;

            if (messageFormat == MessageFormat.Xml)
                ParseXml();
            else
                ParseJson();

            return response;
        }

        private void ParseJson()
        {

        }

        private void ParseXml()
        {

        }

    }
}
